package com.fengjing.launcher.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.SystemProperties;
import android.widget.Toast;

import java.io.IOException;

/**
 * Created by wangjianqiang on 2017/12/25 14:20.
 * Package name com.fengjing.launcher.receiver
 */

public class ShutDownReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        SystemProperties.set("persist.sys.usb.config", "adb");
        String txt = "fuck you onReceive shut down commond";
        try {
            Runtime.getRuntime().exec("reboot -p");
            Toast.makeText(context,txt,Toast.LENGTH_LONG).show();
        } catch (IOException e) {
            e.printStackTrace();
            Toast.makeText(context,txt+e.toString(),Toast.LENGTH_LONG).show();
        }

    }
}
